library saas_order_meal;
import 'dart:convert';
import 'dart:ui';
import 'package:base_flutter/base_flutter.dart';
import 'package:base_package_init/base_package_init.dart';
export 'package:saas_order_meal/ui/elder_month_food_page.dart';

/// A Calculator.
class Calculator {
  /// Returns [value] plus 1.
  int addOne(int value) => value + 1;
}

typedef OnPrintClickListener = Function(List<String> orderCodes);

extension NetMapExt on Map<String, dynamic> {
  Map<String, dynamic> toRequestStr({String title = "jsonStr"}) {
    return {title:jsonEncode(this)};
  }
}

class SaasOrderMeal{

  static String _baseUrl = "";

  static String get baseUrl => _baseUrl;

  static Color _mainColor = Color(0xff6699ff);
  static Color get mainColor => _mainColor;
  static Color bgColor = Color(0xfff1f1f1);
  ///几选几菜单能否多选
  static bool _canChooseMore = false;
  static bool get  canChooseMore => _canChooseMore;
  static bool _cancelFood = true;
  static bool get cancelFood => _cancelFood;
  ///按天按顿点餐，按周点餐
  static MenuModel menuModel = MenuModel.BY_DAY;
  static bool _checkOldTag = false;
  static bool get checkOldTag => _checkOldTag;

  static bool _needPrint = false;
  static bool get needPrint => _needPrint;
  static bool showGiftRemain = false;
  ///调用收费规则
  static bool needFeeRule = false;

  ///是否验证余额
  static bool needCheckRemain = false;
  ///是否允许余额不够支付
  static bool enableNoRemainPay = true;
  ///是否允许余额为负时支付
  static bool enableBelowZeroPay = true;
  ///是否获取服务器用餐方式
  static bool useNetUseType = false;


  static List<PickerDataWithIdModel> foodTypeSelectList = [
    PickerDataWithIdModel(pickName: '堂食', pickId: '1'),
    PickerDataWithIdModel(pickName: '配送', pickId: '2'),
    PickerDataWithIdModel(pickName: '包厢', pickId: '3')
  ];

  static OnPrintClickListener? onPrintClickListener;

  static String? foodImagePlaceHold;

  static void needPrintTickets(bool needPrint){
    _needPrint = needPrint;
  }
  
  static void setFoodTypeSelectList(List<PickerDataWithIdModel> list){
    foodTypeSelectList =list;
  }

  static void needCheckTag(bool checkOldTag){
    _checkOldTag = checkOldTag;
  }

  static void initBaseUrl(String url){
    _baseUrl = url;
    SaasPackageInit.initBaseUrl(_baseUrl);
  }

  static void setMainColor(Color color){
    _mainColor = color;
    SaasPackageInit.setMainColor(color);
  }

  static void setChooseMore(bool can){
    _canChooseMore = can;
  }

  static void setCancelFoodEnable(bool can){
    _cancelFood = can;
  }

  static void setMenuModel(MenuModel model){
    menuModel = model;
  }



}
enum MenuModel{
  BY_WEEK,
  BY_DAY
}